<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html dir="ltr" lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <title>控制面板</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
    

    <link href="/Public/Back/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
    <link href="/Public/Back/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet" />
    <link href="/Public/Back/stylesheet/stylesheet.css" type="text/css" rel="stylesheet" media="screen" />

    
        <link href="/Public/Back/datetimepicker/bootstrap-datetimepicker.min.css"
              type="text/css" rel="stylesheet" media="screen">
        <link href="/Public/Back/summernote/summernote.css" type="text/css"
              rel="stylesheet" media="screen">
        <link href="/Public/Back/jqueryFileUpload/css/jquery.fileupload.css"
              type="text/css" rel="stylesheet" media="screen">
        <link href="/Public/Back/jqueryFileUpload/css/jquery.fileupload-ui.css"
              type="text/css" rel="stylesheet" media="screen">
    
</head>
<body data-public="/Public/" data-root="/">
<div id="container">
    <!--header独立-->
    <header id="header" class="navbar navbar-static-top">
    <div class="navbar-header">
        <a type="button" id="button-menu" class="pull-left"> <i class="fa fa-indent fa-lg"></i>
        </a>
        <a href="" class="navbar-brand">
            <img src="/Public/Back/image/logo.png" alt="OpenCart" title="OpenCart" />
        </a>
    </div>
    <ul class="nav pull-right">
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown">
                <span class="label label-danger pull-left">0</span> <i class="fa fa-bell fa-lg"></i>
            </a>
            <ul class="dropdown-menu dropdown-menu-right alerts-dropdown">
                <li class="dropdown-header">订单管理</li>
                <li>
                    <a href="" style="display: block; overflow: auto;">
                        <span class="label label-warning pull-right">0</span>
                        处理中订单
                    </a>
                </li>
                <li>
                    <a href="">
                        <span class="label label-success pull-right">0</span>
                        已完成订单
                    </a>
                </li>
                <li>
                    <a href="">
                        <span class="label label-danger pull-right">0</span>
                        退货
                    </a>
                </li>
                <li class="divider"></li>
                <li class="dropdown-header">客户列表</li>
                <li>
                    <a href="">
                        <span class="label label-success pull-right">0</span>
                        在线客户
                    </a>
                </li>
                <li>
                    <a href="">
                        <span class="label label-danger pull-right">0</span>
                        待审批
                    </a>
                </li>
                <li class="divider"></li>
                <li class="dropdown-header">商品</li>
                <li>
                    <a href="">
                        <span class="label label-danger pull-right">0</span>
                        缺货
                    </a>
                </li>
                <li>
                    <a href="">
                        <span class="label label-danger pull-right">0</span>
                        评论
                    </a>
                </li>
                <li class="divider"></li>
                <li class="dropdown-header">加盟</li>
                <li>
                    <a href="">
                        <span class="label label-danger pull-right">0</span>
                        待审批
                    </a>
                </li>
            </ul>
        </li>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-life-ring fa-lg"></i>
            </a>
            <ul class="dropdown-menu dropdown-menu-right">
                <li class="dropdown-header">
                    网店名称
                    <i class="fa fa-shopping-cart"></i>
                </li>
                <li>
                    <a href="" target="_blank">BuyPlus(败家Shopping)</a>
                </li>
                <li class="divider"></li>
                <li class="dropdown-header">
                    帮助
                    <i class="fa fa-life-ring"></i>
                </li>
                <li>
                    <a href="" target="_blank">技术支持</a>
                </li>
                <li>
                    <a href="" target="_blank">支持文档</a>
                </li>
                <li>
                    <a href="" target="_blank">应用商店</a>
                </li>
            </ul>
        </li>
        <li>
            <a href="">
                <span class="hidden-xs hidden-sm hidden-md">注销</span>
                <i class="fa fa-sign-out fa-lg"></i>
            </a>
        </li>
    </ul>
</header>

    <nav id="column-left">

        <!--管理员信息独立-->
        <div id="profile">
    <div>
        <!-- <i class="fa fa-opencart"></i>
      -->
        <img src="/Public/Back/image/avatar.png" style="max-width:42px; max-height: 42px;" ></div>
    <div>
        <h4>HelloKang</h4>
        <small>Administrator</small>
    </div>
</div>

        <!-- 菜单独立 -->
        <ul id="menu">
    <li id="dashboard">
        <a href="">
            <i class="fa fa-dashboard fa-fw"></i>
            <span>管理首页</span>
        </a>
    </li>
    <li id="catalog">
        <a class="parent">
            <i class="fa fa-tags fa-fw"></i>
            <span>商品目录</span>
        </a>
        <ul>
            <li>
                <a href="">商品分类</a>
            </li>
            <li>
                <a href="">商品管理</a>
            </li>
            <li class="hidden">
                <a href="">分期付款</a>
            </li>
            <li>
                <a href="">筛选过滤</a>
            </li>
            <li>
                <a class="parent">商品属性</a>
                <ul>
                    <li>
                        <a href="">商品属性</a>
                    </li>
                    <li>
                        <a href="">属性组</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="">商品选项</a>
            </li>
            <li>
                <a href="">品牌管理</a>
            </li>
            <li>
                <a href="">下载设置</a>
            </li>
            <li>
                <a href="">商品评论</a>
            </li>
            <li>
                <a href="">信息管理</a>
            </li>
        </ul>
    </li>
    <li id="extension">
        <a class="parent">
            <i class="fa fa-puzzle-piece fa-fw"></i>
            <span>扩展功能</span>
        </a>
        <ul>
            <li>
                <a href="">扩展安装</a>
            </li>
            <li>
                <a href="">扩展配置</a>
            </li>
            <li>
                <a href="">流量分析</a>
            </li>
            <li>
                <a href="">验证码</a>
            </li>
            <li>
                <a href="">插件扩展</a>
            </li>
            <li>
                <a href="">反欺诈</a>
            </li>
            <li>
                <a href="">模块配置</a>
            </li>
            <li>
                <a href="">支付管理</a>
            </li>
            <li>
                <a href="">配送管理</a>
            </li>
            <li>
                <a href="">订单配置</a>
            </li>
        </ul>
    </li>
    <li id="design">
        <a class="parent">
            <i class="fa fa-television fa-fw"></i>
            <span>页面设计</span>
        </a>
        <ul>
            <li>
                <a href="">布局</a>
            </li>
            <li>
                <a href="">横幅</a>
            </li>
        </ul>
    </li>
    <li id="sale">
        <a class="parent">
            <i class="fa fa-shopping-cart fa-fw"></i>
            <span>营销推广</span>
        </a>
        <ul>
            <li>
                <a href="">订单管理</a>
            </li>
            <li class="hidden">
                <a href="">分期付款订单</a>
            </li>
            <li>
                <a href="">商品退换</a>
            </li>
            <li>
                <a class="parent">礼品券</a>
                <ul>
                    <li>
                        <a href="">礼品券</a>
                    </li>
                    <li>
                        <a href="">礼品券主题</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent hidden">PayPal</a>
                <ul>
                    <li>
                        <a href="">搜寻交易记录</a>
                    </li>
                </ul>
            </li>
        </ul>
    </li>
    <li id="customer">
        <a class="parent">
            <i class="fa fa-user fa-fw"></i>
            <span>客户列表</span>
        </a>
        <ul>
            <li>
                <a href="">客户列表</a>
            </li>
            <li>
                <a href="">客户群组</a>
            </li>
            <li>
                <a href="">自定义区</a>
            </li>
        </ul>
    </li>
    <li>
        <a class="parent">
            <i class="fa fa-share-alt fa-fw"></i>
            <span>市场营销</span>
        </a>
        <ul>
            <li>
                <a href="">市场营销</a>
            </li>
            <li>
                <a href="">加盟会员</a>
            </li>
            <li>
                <a href="">优惠券设置</a>
            </li>
            <li>
                <a href="">Mail</a>
            </li>
        </ul>
    </li>
    <li id="system">
        <a class="parent">
            <i class="fa fa-cog fa-fw"></i>
            <span>系统设置</span>
        </a>
        <ul>
            <li>
                <a href="">网店设置</a>
            </li>
            <li>
                <a class="parent">用户管理</a>
                <ul>
                    <li>
                        <a href="">用户管理</a>
                    </li>
                    <li>
                        <a href="">用户群组</a>
                    </li>
                    <li>
                        <a href="">API</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent">参数设置</a>
                <ul>
                    <li>
                        <a href="">店铺地址</a>
                    </li>
                    <li>
                        <a href="">语言设置</a>
                    </li>
                    <li>
                        <a href="">货币设置</a>
                    </li>
                    <li>
                        <a href="">库存状态</a>
                    </li>
                    <li>
                        <a href="">订单状态</a>
                    </li>
                    <li>
                        <a class="parent">商品退换</a>
                        <ul>
                            <li>
                                <a href="">退换状态</a>
                            </li>
                            <li>
                                <a href="">退换管理</a>
                            </li>
                            <li>
                                <a href="">退换原因</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="">省/直辖市设置</a>
                    </li>
                    <li>
                        <a href="">城市设置</a>
                    </li>
                    <li>
                        <a href="">区县</a>
                    </li>
                    <li>
                        <a href="">区域群组</a>
                    </li>
                    <li>
                        <a class="parent">商品税种</a>
                        <ul>
                            <li>
                                <a href="">税率类别</a>
                            </li>
                            <li>
                                <a href="">商品税率</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="">尺寸单位</a>
                    </li>
                    <li>
                        <a href="">重量单位</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent">相关工具</a>
                <ul>
                    <li>
                        <a href="">上传文件</a>
                    </li>
                    <li>
                        <a href="">备份/恢复</a>
                    </li>
                    <li>
                        <a href="">错误日志</a>
                    </li>
                </ul>
            </li>
        </ul>
    </li>
    <li id="reports">
        <a class="parent">
            <i class="fa fa-bar-chart-o fa-fw"></i>
            <span>统计报表</span>
        </a>
        <ul>
            <li>
                <a class="parent">营销推广</a>
                <ul>
                    <li>
                        <a href="">商品销售统计</a>
                    </li>
                    <li>
                        <a href="">商品销售税费统计</a>
                    </li>
                    <li>
                        <a href="">运费统计</a>
                    </li>
                    <li>
                        <a href="">退换商品统计</a>
                    </li>
                    <li>
                        <a href="">折扣商品统计</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent">商品管理</a>
                <ul>
                    <li>
                        <a href="">商品浏览统计</a>
                    </li>
                    <li>
                        <a href="">商品购买统计</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent">客户列表</a>
                <ul>
                    <li>
                        <a href="">在线客户统计</a>
                    </li>
                    <li>
                        <a href="">客户活动统计</a>
                    </li>
                    <li>
                        <a href="">客户订单统计</a>
                    </li>
                    <li>
                        <a href="">奖励积分统计</a>
                    </li>
                    <li>
                        <a href="">客户余额统计</a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="parent">市场营销</a>
                <ul>
                    <li>
                        <a href="">市场营销</a>
                    </li>
                    <li>
                        <a href="">加盟会员</a>
                    </li>
                    <li>
                        <a href="">加盟会员活动统计</a>
                    </li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

        <!--状态独立-->
        <div id="stats">
    <ul>
        <li>
            <div>
                订单已经完成
                <span class="pull-right">0%</span>
            </div>
            <div class="progress">
                <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
                    <span class="sr-only">0%</span>
                </div>
            </div>
        </li>
        <li>
            <div>
                订单待处理
                <span class="pull-right">0%</span>
            </div>
            <div class="progress">
                <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
                    <span class="sr-only">0%</span>
                </div>
            </div>
        </li>
        <li>
            <div>
                其它状态
                <span class="pull-right">0%</span>
            </div>
            <div class="progress">
                <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
                    <span class="sr-only">0%</span>
                </div>
            </div>
        </li>
    </ul>
</div>

    </nav>

    
        <div id="content">
            <div class="page-header">
                <div class="container-fluid">
                    <div class="pull-right">
                        <button type="submit" form="form-set" data-toggle="tooltip" title="保存" class="btn btn-primary">
                            <i class="fa fa-save"></i>
                        </button>
                        <a href="<?php echo U('list');?>" data-toggle="tooltip" title="取消" class="btn btn-default">
                            <i class="fa fa-reply"></i>
                        </a>
                    </div>
                    <h1>商品</h1>
                    <ul class="breadcrumb">
                        <li>
                            <a href="<?php echo U('Manage/index');?>">首页</a>
                        </li>
                        <li>
                            <a href="javascript:;">商品</a>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="container-fluid">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                            <i class="fa fa-pencil"></i>
                            设置商品
                        </h3>
                    </div>
                    <div class="panel-body">
                        <form action="<?php echo U('set');?>" method="post" enctype="multipart/form-data" id="form-set"
                        class="form-horizontal">
                            <?php if(isset($data['goods_id'])): ?><input type="hidden" name="goods_id" value="<?php echo ($data['goods_id']); ?>" id="input-goods_id"><?php endif; ?>
                            <ul class="nav nav-tabs">
                                <li class="active">
                                    <a href="#tab-general" data-toggle="tab">基本信息</a>
                                </li>
                                <li>
                                    <a href="#tab-description" data-toggle="tab">商品描述</a>
                                </li>
                                <li>
                                    <a href="#tab-seo" data-toggle="tab">SEO项目</a>
                                </li>
                                <li>
                                    <a href="#tab-links" data-toggle="tab">关联项目</a>
                                </li>
                                <li>
                                    <a href="#tab-attribute" data-toggle="tab">属性</a>
                                </li>
                                <li>
                                    <a href="#tab-discount" data-toggle="tab">促销活动</a>
                                </li>
                                <li>
                                    <a href="#tab-image" data-toggle="tab">图片设置</a>
                                </li>
                            </ul>
              <div class="tab-content">
                    <div class="tab-pane active" id="tab-general">

                                    <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-name">商品</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="商品"
                     name="name" id="input-name" value="<?php echo ($data['name']); ?>"/>
                     <?php if(isset($message['name'])): ?><label for="input-name" class="text-danger"><?php echo ($message['name']); ?></label><?php endif; ?>
                 </div>
                </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-image">原始图像</label>
                            <div class="col-sm-6">
                                <input type="hidden" name="image" id="input-image-value">
                                <input type="hidden" name="image_thumb" id="input-image_thumb-value">
                                <span class="btn btn-success fileinput-button">
                                            <i class="glyphicon glyphicon-plus"></i>
                                            <span>添加文件</span>
                                            <input id="input-image" name="image" type="file"
                                         data-uploadurl="<?php echo U('upload');?>">
                          </span>
                                <?php if(isset($message['image'])): ?><label for="input-image" class="text-danger"><?php echo ($message['image']); ?></label><?php endif; ?>
                            </div>
                            <div class="class-sm-4">
                                <img src="/Public/Thumb/<?php echo ($data['image_thumb']); ?>" alt="" id="image-show"
                                     class="img-thumbnail" style="max-height: 50px; <?php if( $data['image'] == ''): ?>display:none;<?php endif; ?>" />
                            </div>
                        </div>
                        <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-quantity">库存</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="库存"
                     name="quantity" id="input-quantity" value="<?php echo ((isset($data['quantity']) && ($data['quantity'] !== ""))?($data['quantity']):1); ?>"/>
                     <?php if(isset($message['quantity'])): ?><label for="input-quantity" class="text-danger"><?php echo ($message['quantity']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-sku_id">库存单位</label>
                      <div class="col-sm-10">
                     <select class="form-control" name="sku_id"  id="input-sku_id"
                             data-checkurl="<?php echo U('check', ['field'=>'sku_id']);?>>
                         <?php if(is_array($sku_list)): $i = 0; $__LIST__ = $sku_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sku): $mod = ($i % 2 );++$i;?><option value="<?php echo ($sku['sku_id']); ?>"
                                 <?php if($data['sku_id'] == $sku['sku_id']): ?>selected<?php endif; ?> >
                                 <?php echo ($sku['title']); ?>
                             </option><?php endforeach; endif; else: echo "" ;endif; ?>
                     </select>
                     <?php if(isset($message['sku_id'])): ?><label for="input-sku_id" class="text-danger"><?php echo ($message['sku_id']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-upc">商品编码</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="商品编码"
                     name="upc" id="input-upc" value="<?php echo ($data['upc']); ?>"/>
                     <?php if(isset($message['upc'])): ?><label for="input-upc" class="text-danger"><?php echo ($message['upc']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-price">价格</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="价格"
                     name="price" id="input-price" value="<?php echo ($data['price']); ?>"/>
                     <?php if(isset($message['price'])): ?><label for="input-price" class="text-danger"><?php echo ($message['price']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-market_price">市场价</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="市场价"
                     name="market_price" id="input-market_price" value="<?php echo ($data['market_price']); ?>"/>
                     <?php if(isset($message['market_price'])): ?><label for="input-market_price" class="text-danger"><?php echo ($message['market_price']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-tax_id">税类型</label>
                      <div class="col-sm-10">
                     <select class="form-control"
                     name="tax_id" id="input-tax_id" >
                          <?php if(is_array($tax_list)): $i = 0; $__LIST__ = $tax_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tax): $mod = ($i % 2 );++$i;?><option value="<?php echo ($tax['tax_id']); ?>"> <?php if($data['tax_id'] == $tax['tax_id']): ?>selected<?php endif; ?>
                                  <?php echo ($tax['title']); ?>
                              </option><?php endforeach; endif; else: echo "" ;endif; ?>
                      </select>
                     <?php if(isset($message['tax_id'])): ?><label for="input-tax_id" class="text-danger"><?php echo ($message['tax_id']); ?></label><?php endif; ?>
                 </div>
                </div>
                    <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-minimum">起售数量</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="起售数量"
                     name="minimum" id="input-minimum" value="<?php echo ($data['minimum']); ?>"/>
                     <?php if(isset($message['minimum'])): ?><label for="input-minimum" class="text-danger"><?php echo ($message['minimum']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-subtract">是否减少库存</label>
                      <div class="col-sm-10">
                     <input type="checkbox" class="form-control"
                     name="subtract" id="input-subtract" value="1" <?php if($data['subtract'] == 1 OR !isset($data['subtract'])): ?>checked<?php endif; ?> />
                     <?php if(isset($message['subtract'])): ?><label for="input-subtract" class="text-danger"><?php echo ($message['subtract']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-stock_status_id">库存状态</label>
                      <div class="col-sm-10">
                     <select  class="form-control"
                     name="stock_status_id" id="input-stock_status_id">
                         <?php if(is_array($stock_status_list)): $i = 0; $__LIST__ = $stock_status_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$stock_status): $mod = ($i % 2 );++$i;?><option value="<?php echo ($stock_status['stock_status_id']); ?>" <?php if($data['stock_status_id'] == $stock_status['stock_status_id']): ?>selected<?php endif; ?> >
                             <?php echo ($stock_status['title']); ?>

                             </option><?php endforeach; endif; else: echo "" ;endif; ?>
                     </select>
                     <?php if(isset($message['stock_status_id'])): ?><label for="input-stock_status_id" class="text-danger"><?php echo ($message['stock_status_id']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-shipping">是否配送</label>
                      <div class="col-sm-10">
                     <input type="checkbox" class="form-control"
                     name="shipping" id="input-shipping" value="1" <?php if($data['shipping'] == 1 OR !isset($data['shipping'])): ?>checked<?php endif; ?> />
                     <?php if(isset($message['shipping'])): ?><label for="input-shipping" class="text-danger"><?php echo ($message['shipping']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-date_available">起售日期</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="起售日期"
                     name="date_available" id="input-date_available" value="<?php echo ($data['date_available']); ?>"/>
                     <?php if(isset($message['date_available'])): ?><label for="input-date_available" class="text-danger"><?php echo ($message['date_available']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-length">长</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="长"
                     name="length" id="input-length" value="<?php echo ($data['length']); ?>"/>
                     <?php if(isset($message['length'])): ?><label for="input-length" class="text-danger"><?php echo ($message['length']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-width">宽</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="宽"
                     name="width" id="input-width" value="<?php echo ($data['width']); ?>"/>
                     <?php if(isset($message['width'])): ?><label for="input-width" class="text-danger"><?php echo ($message['width']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-height">高</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="高"
                     name="height" id="input-height" value="<?php echo ($data['height']); ?>"/>
                     <?php if(isset($message['height'])): ?><label for="input-height" class="text-danger"><?php echo ($message['height']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-length_unit_id">长度单位</label>
                      <div class="col-sm-10">
                     <select  class="form-control"
                     name="length_unit_id" id="input-length_unit_id" >
                         <?php if(is_array($length_unit_list)): $i = 0; $__LIST__ = $length_unit_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$length_unit): $mod = ($i % 2 );++$i;?><option value="<?php echo ($length_unit['length_unit_id']); ?>" <?php if($data['length_unit_id'] == $length_unit['length_unit_id']): ?>selected<?php endif; ?> ><?php echo ($length_unit['title']); ?>

                             </option><?php endforeach; endif; else: echo "" ;endif; ?>
                     </select>
                     <?php if(isset($message['length_unit_id'])): ?><label for="input-length_unit_id" class="text-danger"><?php echo ($message['length_unit_id']); ?></label><?php endif; ?>
                 </div>
                </div>
                    <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-weight">重量</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="重量"
                     name="weight" id="input-weight" value="<?php echo ($data['weight']); ?>"/>
                     <?php if(isset($message['weight'])): ?><label for="input-weight" class="text-danger"><?php echo ($message['weight']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-weight_unit_id">重量单位</label>
                      <div class="col-sm-10">
                     <select class="form-control"
                     name="weight_unit_id" id="input-weight_unit_id" >
                         <?php if(is_array($weight_unit_list)): $i = 0; $__LIST__ = $weight_unit_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$weight_unit): $mod = ($i % 2 );++$i;?><option value="<?php echo ($weight_unit['weight_unit_id']); ?>" <?php if($data['weight_unit_id'] == $weight_unit['weight_unit_id']): ?>selected<?php endif; ?> ><?php echo ($weight_unit['title']); ?>

                             </option><?php endforeach; endif; else: echo "" ;endif; ?>
                     </select>
                     <?php if(isset($message['weight_unit_id'])): ?><label for="input-weight_unit_id" class="text-danger"><?php echo ($message['weight_unit_id']); ?></label><?php endif; ?>
                 </div>
                </div><div class="form-group">
                    <label class="col-sm-2 control-label" for="input-status">状态</label>
                      <div class="col-sm-10">
                     <input type="checkbox" class="form-control"
                          name="status" id="input-status" value="1" <?php if($data['status'] == 1 OR !isset($data['status'])): ?>checked<?php endif; ?> />
                     <?php if(isset($message['status'])): ?><label for="input-status" class="text-danger"><?php echo ($message['status']); ?></label><?php endif; ?>
                 </div>
                </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-type_id">类型</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" placeholder="类型"
                                       name="type_id" id="input-type_id" value="<?php echo ($data['type_id']); ?>"/>
                                <?php if(isset($message['type_id'])): ?><label for="input-type_id" class="text-danger"><?php echo ($message['type_id']); ?></label><?php endif; ?>
                            </div>
                        </div>




                  <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-sort_number">排序</label>
                      <div class="col-sm-10">
                     <input type="text" class="form-control" placeholder="排序"
                     name="sort_number" id="input-sort_number" value="<?php echo ($data['sort_number']); ?>"/>
                     <?php if(isset($message['sort_number'])): ?><label for="input-sort_number" class="text-danger"><?php echo ($message['sort_number']); ?></label><?php endif; ?>
                 </div>
                </div>
         </div>
                  <div class="tab-pane" id="tab-description">
                      <div class="form-group">
                          <label class="col-sm-2 control-label" for="input-description">描述</label>
                          <div class="col-sm-10">
                              <textarea class="form-control" placeholder="描述" name="description"
                              id="input-description"
                                  data-uploadurl="<?php echo U('upload',['type'=>'description']);?>"><?php echo ($data['description']); ?></textarea>
                              <?php if(isset($message['description'])): ?><label for="input-description" class="text-danger"><?php echo ($message['description']); ?></label><?php endif; ?>
                          </div>
                      </div>
                  </div>
                  <div class="tab-pane" id="tab-seo">
                      <div class="form-group">
                          <label class="col-sm-2 control-label" for="input-meta_title">META标题</label>
                          <div class="col-sm-10">
                              <input type="text" class="form-control" placeholder="META标题"
                                     name="meta_title" id="input-meta_title" value="<?php echo ($data['meta_title']); ?>"/>
                              <?php if(isset($message['meta_title'])): ?><label for="input-meta_title" class="text-danger"><?php echo ($message['meta_title']); ?></label><?php endif; ?>
                          </div>
                      </div><div class="form-group">
                      <label class="col-sm-2 control-label" for="input-meta_keywords">META关键字</label>
                      <div class="col-sm-10">
                          <input type="text" class="form-control" placeholder="META关键字"
                                 name="meta_keywords" id="input-meta_keywords" value="<?php echo ($data['meta_keywords']); ?>"/>
                          <?php if(isset($message['meta_keywords'])): ?><label for="input-meta_keywords" class="text-danger"><?php echo ($message['meta_keywords']); ?></label><?php endif; ?>
                      </div>
                  </div><div class="form-group">
                      <label class="col-sm-2 control-label" for="input-meta_description">META描述</label>
                      <div class="col-sm-10">
                          <textarea  class="form-control" placeholder="META描述"
                                     name="meta_description" id="input-meta_description"> <?php echo ($data['meta_description']); ?></textarea>
                          <?php if(isset($message['meta_description'])): ?><label for="input-meta_description" class="text-danger"><?php echo ($message['meta_description']); ?></label><?php endif; ?>
                      </div>
                  </div>
                  </div>
                   <div class="tab-pane" id="tab-links">
                       <div class="form-group">
                           <label class="col-sm-2 control-label" for="input-brand_id">品牌</label>
                           <div class="col-sm-10">
                               <select class="form-control"  name="brand_id" id="input-brand_id">
                                   <?php if(is_array($brand_list)): $i = 0; $__LIST__ = $brand_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$brand): $mod = ($i % 2 );++$i;?><option value="<?php echo ($brand['brand_id']); ?>" <?php if($data['brand_id'] == $brand['brand_id']): ?>selected<?php endif; ?> >
                                           <?php echo ($brand['title']); ?>
                                       </option><?php endforeach; endif; else: echo "" ;endif; ?>
                               </select>
                               <?php if(isset($message['brand_id'])): ?><label for="input-brand_id" class="text-danger"><?php echo ($message['brand_id']); ?></label><?php endif; ?>
                           </div>
                       </div>
                       <div class="form-group">
                           <label class="col-sm-2 control-label" for="input-category">分类</label>
                           <div class="col-sm-10">
                               <select class="form-control" name="category_id[]" id="input-category"  multiple size="10">
                                   <?php if(is_array($category_list)): $i = 0; $__LIST__ = $category_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?><option value="<?php echo ($category['category_id']); ?>"
                                       <?php if(in_array($category['category_id'],$category_linked)): ?>selected<?php endif; ?> >
                                       <?php echo str_repeat('&nbsp;', $category['deep']*2); echo ($category['category_title']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                               </select>
                               <?php if(isset($message['category_id'])): ?><label for="input-category" class="text-danger"><?php echo ($message['category_id']); ?></label><?php endif; ?>
                           </div>
                       </div>
                   </div>

                  <div class="tab-pane" id="tab-image">
                      <div class="table-responsive">
                          <table id="table-galleries" class="table table-striped table-bordered table-hover"
                                 data-removeurl="<?php echo U('remove');?>">
                              <thead>
                              <tr>
                                  <td class="col-sm-4 text-left">图片</td>
                                  <td  class="col-sm-4 text-left">描述</td >
                                  <td  class="col-sm-4 text-right">排序</td >
                                  <td></td>
                              </tr>
                              </thead>
                              <tbody>
                              <?php if(is_array($gallery_list)): $i = 0; $__LIST__ = $gallery_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$gallery): $mod = ($i % 2 );++$i;?><tr id="image-row-<?php echo ($key); ?>">
                                      <td class="text-left">
                                          <input  type="hidden" name="galleries[<?php echo ($key); ?>][gallery_id]" value="<?php echo ($gallery['gallery_id']); ?>">
                                          <img src="/Public/Thumb/<?php echo ($gallery['image_small']); ?>" alt="NO-IMG" title="">
                                      </td>
                                      <td class="text-right">
                                          <input name="galleries[<?php echo ($key); ?>][intro]" value="<?php echo ($gallery['intro']); ?>"
                                                 placeholder="描述" class="form-control" type="text">
                                      </td>
                                      <td class="text-right">
                                          <input name="galleries[<?php echo ($key); ?>][sort_number]" value="<?php echo ($gallery['sort_number']); ?>"
                                                 placeholder="排序" class="form-control valid" aria-invalid="false" type="text">
                                      </td>
                                      <td class="text-left">
                                          <button type="button" data-toggle="tooltip" title=""
                                                  class="btn btn-danger remove-button" data-original-title="移除"
                                          data-gallery_id="<?php echo ($gallery['gallery_id']); ?>"><i class="fa fa-minus-circle"></i></button>
                                      </td>
                                  </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                              </tbody>
                              <tfoot>
                              <tr>
                                  <td  colspan="4" class="text-right">

                                                        <span class="btn btn-success fileinput-button">
                                                            <i class="glyphicon glyphicon-plus"></i>
                                                            <span >选择图片</span>
                                 <input id="input-galleries" name="galleries" type="file"
                                        multiple data-uploadurl="<?php echo U('upload', ['type'=>'gallery']);?>">
                                                        </span>
                                  </td>
                              </tr>
                              </tfoot>
                          </table>
                      </div>
                            </div>
              </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    

    <!--footer独立-->
    <footer id="footer">
    <a href="">BuyPlus(败家Shopping) HelloKang</a>
    <br>
    &copy; 2009-2016 All Rights Reserved.
    <br>Version 1.0
</footer>


</div>

<script type="text/javascript" src="/Public/Back/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/Public/Back/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/Back/javascript/common.js"></script>


        <script src="/Public/Back/validate/jquery.validate.min.js"></script>
        <script src="/Public/Back/validate/additional-methods.min.js"></script>
        <script src="/Public/Back/validate/localization/messages_zh.min.js"></script>
        <script src="/Public/Back/datetimepicker/moment.js"></script>
        <script src="/Public/Back/datetimepicker/bootstrap-datetimepicker.min.js"></script>
        <script src="/Public/Back/summernote/summernote.js"></script>
        <script src="/Public/Back/jqueryFileUpload/js/vendor/jquery.ui.widget.js"></script>
        <script src="/Public/Back/jqueryFileUpload/js/jquery.fileupload.js"></script>
        <script>
            $(function(){
                $('#input-date_available').datetimepicker({
                    pickDate: true,
                    pickTime: false,
                    format: 'YYYY-MM-DD',
                });
            });
        </script>
        <script>
            $(function () {
                var editor=$('#input-description').summernote({
                    height:400,
                    callbacks:{
                        onImageUpload:function (fileList) {

                            var data=new FormData();

                            data.append('image',fileList[0]);
                            $.ajax({
                                type:'post',
                                url: $('#input-description').data('uploadurl'),
                                data: data,
                                contentType:false,
                                processData:false,
                                success: function (response) {
                                    if(response.error===0){
                                        //成功了
                                        editor.summernote('insertImage',$('body').data('root')+'Upload/'+response.image);
                                    }

                                }
                            });
                        }
                    }
                });
            })
        </script>

        <script>
            $(function(){
                var validator= $('#form-set').validate({
                    rules:{
                        sku_id:{
                            remote:$('#input-sku_id').data('checkurl')
                        }
                    },
                    messages:{
                        sku_id:{
                            remote:'选择合理的库存单位',
                        }
                    },
                    errorClass:'text-danger',
                });
                $('#input-sku_id').change(function(evt) {
                    validator.element($(this));
                });
            });
        </script>
        <script>
            $(function () {
                $('#input-image').fileupload({
                    // 负责完成动作
                    url: $('#input-image').data('uploadurl'),
                    dataType: 'json',
                    // 上传成功后, 回调的函数,
                    done: function (evt, response) {
                        var data = response.result;
                        if (0 === data.error) {
                            // 将图像反显
                            $('#image-show').attr('src', $('body').data('public') + 'Thumb/' + data.image_thumb).show();
                            $('#input-image-value').val(data.image);
                            $('#input-image_thumb-value').val(data.image_thumb);
                        }
                    }
                });
            })
        </script>
        <script>
            $(function(){
                //移出绑定事件
                $('#table-galleries').delegate('button.remove-button','click',function(evt) {
                    var currButton=$(this);
                    //ajax删除服务器上的记录数和图像
                    var url=$('#table-galleries').data('removeurl');

                    var data={
                        gallery_id:currButton.data('gallery_id'),
                        image_small:currButton.data('image_small')
                    };
                    $.post(url,data,function(response){
                        //删除所在的行
                        currButton.parents('tr').remove();
                    },'json');
                    evt.preventDefault();
                })
            })
        </script>
        <script>

            $(function () {
                // 初始化一个变量
                var galleryIndex = $('#table-galleries>tbody>tr').size();
                $('#input-galleries').fileupload({
                    url: $('#input-galleries').data('uploadurl'),
                    datatype: 'json',
                    done: function(evt, response)
                    {
                        var data = response.result;
                        if (data.error === 0) {
                            // 没出错完成反显
                            var html = '<tr id="image-row-' + galleryIndex +
                                '">' +
                                '<td class="text-left">' +
                                '<input type="hidden" name="galleries[' + galleryIndex +
                                '][image]" value="' + data.image +
                                '">' +
                                '<input type="hidden" name="galleries[' + galleryIndex +
                                '][image_big]" value="' + data.image_big +
                                '">' +
                                '<input type="hidden" name="galleries[' + galleryIndex +
                                '][image_medium]" value="' + data.image_medium +
                                '">' +
                                '<input type="hidden" name="galleries[' + galleryIndex +
                                '][image_small]" value="' + data.image_small +
                                '">' +
                                '<img src="' + $('body').data('public') + 'Thumb/' + data.image_small +
                                '" alt="NO-IMG" title="">' +
                                '</td>' +
                                '<td class="text-right">' +
                                '<input name="galleries[' + galleryIndex +
                                '][intro]" value="" placeholder="描述" class="form-control" type="text">' +
                                '</td>' +
                                '<td class="text-right">' +
                                '<input name="galleries[' + galleryIndex +
                                '][sort_number]" value="0" placeholder="排序" class="form-control" type="text">' +
                                '</td>' +
                                '<td class="text-left">' +
                                '<button type="button" data-toggle="tooltip" title="移出" class="btn btn-danger remove-button"'+' data.image_small="'+data.image_small+'"'+'>'+
                                '<i class="fa fa-minus-circle"></i></button>' +
                                '</td>' +
                                '</tr>';
                            $('#table-galleries>tbody').append(html);

                            // 索引递增
                            ++ galleryIndex;
                        }
                    }
                });
            })
        </script>


    
</body>
</html>